const mixins = require('../../common/mixins/index')

Page({
    data: {
        isTop: true,
        info: {},
        showVoteWindow: false,
        accountSufficient: true
    },

    async onLoad(options) {
        this.getInfo()
        await mixins.onJudgeAccountSufficient(this)
    },

    getInfo() {
        this.getOpenerEventChannel().on('detail', info => {
            this.setData({info})
        })
    },

    async onVote(e) {
        await mixins.onVote(e, this)
        await mixins.onJudgeAccountSufficient(this)
    },

    onTapVoteButton() {
        mixins.onTapVoteButton(this)
    },

    onPreview(e) {
        mixins.onPreview(e)
    },

    onPageScroll(e) {
        mixins.onPageScroll(e, this, 'isTop')
    },

    getCustomNavBarTop(e) {
        this.setData({top: e.detail})
    },

    onShareAppMessage(e) {
        return mixins.onShare(e, undefined, `/pages/login/login`, this)
    },

    onShareTimeline(e) {
        return mixins.onShare(e, undefined, `/pages/login/login`, this)
    }

});
